﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using JqueryNet.WinFormControl;

namespace JqueryNet
{
    public class JQueryForm
    {
        public object Value { get; private set; }

        private IJQueryForm Ijquery { get; set; }

        private JQueryForm(IJQueryForm query) { Ijquery = query; }

        public static JQueryForm Get(Control _control)
        {
            WinFormContentFactory factory = new WinFormContentFactory();
            return new JQueryForm(factory.CreateIJquery(_control));
        }

        public static JQueryForm Get(IJQueryForm ijquery)
        {
            return new JQueryForm(ijquery);
        }

        public JQueryForm Val()
        {
            Ijquery.Val();
            Value = Ijquery.Value;
            return this;
        }

        public JQueryForm Val(string value)
        {
            Ijquery.Val(value);
            return this;
        }

        public JQueryForm Val(Func<string> fun)
        {
            return Val(fun());
        }

        public JQueryForm Val(string[] values)
        {
            Ijquery.Val(values);
            return this;
        }

        public JQueryForm BindEvent(string eventname, Delegate del)
        {
            Ijquery.BindEvent(eventname, del);
            return this;
        }

    }
}
